var a = require("../../../@babel/runtime/helpers/toConsumableArray"), t = 1, e = getApp();

Page({
    data: {
        groupId: "",
        goods: [],
        allLoaded: !0,
        loading: !1,
        classifyBol: !0,
        goods_template: "",
        requestLoading: !0
    },
    onLoad: function(a) {
        a.id && this.setData({
            groupId: a.id
        }), this.getData();
    },
    onShow: function() {},
    getData: function() {
        var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, o = this, d = e.getNetAddresss("plugin.group-code.api.group-code.get-goods");
        e._getNetWork({
            showToastIn: !1,
            url: d,
            data: {
                id: o.data.groupId,
                page: t
            },
            success: function(t) {
                var e = t.data;
                if (1 == e.result) {
                    if (o.setData({
                        loading: !1,
                        allLoaded: !1
                    }), e.data.data.length <= 0) return void o.setData({
                        loading: !0,
                        allLoaded: !0
                    });
                    if (e.data.current_page > e.data.last_page) return void o.setData({
                        loading: !0,
                        allLoaded: !0
                    });
                    var d = o.data.goods;
                    d.push.apply(d, a(e.data.data));
                    for (var i = 0; i < d.length; i++) parseInt(Number(0 == d[i].market_price)) ? d[i].notMarket_price = 0 : d[i].notMarket_price = 1;
                    if (o.setData({
                        goods: d,
                        requestLoading: !1
                    }), e.data.data.length < 15) return void o.setData({
                        loading: !0,
                        allLoaded: !0
                    });
                } else o.setData({
                    requestLoading: !1
                });
            },
            fail: function(a) {}
        });
    },
    onReachBottom: function() {
        if (!this.data.allLoaded) {
            t++;
            this.getData(t, !0);
        }
    },
    onShareAppMessage: function() {}
});